package ahead;
import java.sql.*;
import java.util.*;

import javax.servlet.ServletContext;

import basis.DbConnect;

public class SQLThread extends Thread {
	public void run(){
		int th = 0;
		int delay = 1000*60*60;
		while(true){
			try{
				Connection conn = DbConnect.getConnection();
				Statement stm = conn.createStatement();
				stm.executeQuery("select * from mytemp");
				stm.close();
				conn.close();
				System.out.println("Thread:" +th);
				th ++ ;
				sleep(delay);
			}
			catch(Exception e){
				System.out.println("SQLThread.java Exception:"+e.getMessage());
				
				try{sleep(delay);}catch(Exception ee){}
			}
		}		
	}
}
